this.prompt = new Shell.KeyringPrompt();
this.prompt.connect('show-password', Lang.bind(this, this._onShowPassword));
this.prompt.connect('show-confirm', Lang.bind(this, this._onShowConfirm));
- this.prompt.connect('hide-prompt', Lang.bind(this, this._onHidePrompt));
+ this.prompt.connect('prompt-close', Lang.bind(this, this._onHidePrompt));
let mainContentBox = new St.BoxLayout({ style_class: 'prompt-dialog-main-layout',
vertical: false });
enum {
SIGNAL_SHOW_PASSWORD,
SIGNAL_SHOW_CONFIRM,
- SIGNAL_HIDE_PROMPT,
SIGNAL_LAST
};
{
ShellKeyringPrompt *self = SHELL_KEYRING_PROMPT (obj);
- if (self->shown) {
- self->shown = FALSE;
- g_signal_emit (self, signals[SIGNAL_HIDE_PROMPT], 0);
- }
+ if (self->shown)
+ gcr_prompt_close (GCR_PROMPT (self));
if (self->async_result)
shell_keyring_prompt_cancel (self);
0, 0, NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
-
- signals[SIGNAL_HIDE_PROMPT] = g_signal_new ("hide-prompt", G_TYPE_FROM_CLASS (klass),
- 0, 0, NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
}
static void
return self->last_reply;
}
+static void
+shell_keyring_prompt_close (GcrPrompt *prompt)
+{
+ ShellKeyringPrompt *self = SHELL_KEYRING_PROMPT (prompt);
+
+ /*
+ * We expect keyring.js to connect to this signal and do the
+ * actual work of closing the prompt.
+ */
+
+ self->shown = FALSE;
+}
+
static void
shell_keyring_prompt_iface (GcrPromptIface *iface)
{
iface->prompt_password_finish = shell_keyring_prompt_password_finish;
iface->prompt_confirm_async = shell_keyring_prompt_confirm_async;
iface->prompt_confirm_finish = shell_keyring_prompt_confirm_finish;
+ iface->prompt_close = shell_keyring_prompt_close;
}
/**
GSimpleAsyncResult *res;
g_return_if_fail (SHELL_IS_KEYRING_PROMPT (self));
- g_return_if_fail (self->mode != PROMPTING_NONE);
- g_return_if_fail (self->async_result != NULL);
+ /*
+ * If cancelled while not prompting, we should just close the prompt,
+ * the user wants it to go away.
+ */
+ if (self->mode == PROMPTING_NONE)
+ {
+ if (self->shown)
+ gcr_prompt_close (GCR_PROMPT (self));
+ return;
+ }
+
+ g_return_if_fail (self->async_result != NULL);
self->last_reply = GCR_PROMPT_REPLY_CANCEL;
res = self->async_result;